#include<iostream>
#include<cmath>
using namespace std;
int a[10005][2], t[10005];
int main()
{
	int n;
	while (cin >> n && n != 0)
	{
		int mint = 99999;
		for (int i = 1; i <= n; i++)
		{
			cin >> a[i][0] >> a[i][1];
			if (a[i][1] >= 0)
			{
				t[i] = ceil(4500 * 3.6 / a[i][0] + a[i][1]);
				if (mint > t[i])
				{
					mint = t[i];
				}
			}
		}
		cout << mint << endl;
	}
	return 0;
}

